<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../../include.inc.jsp"%>
<div class="row">
	<div class="col-lg-12">
        <div class="tabbable">
            <ul id="myTabs" class="nav nav-tabs">
                <li class="active"><a href="#emp" data-toggle="tab">职工</a></li>
                <li><a href="#user" data-toggle="tab">用户</a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane fade in active" id="emp">
                    <div class="widget-box transparent" id="divSearch1">
			            <div class="widget-body">
			                <div class="widget-main">
			                    <form name="frmSearch" id="frmSearch1" target="_self"  class="form-inline searchCondition">
			                        <!-- 数据权限 begion-->
			                        <c:if test="${organizationId != 1}"><input type="hidden" name="search_EQ_organization.id" value="${organizationId }"/></c:if>
			                        <!-- 数据权限 end-->
			<!--                        <input type="text" name="search_EQ_hospital.id"/> -->
			                        <label>
			                            职工名称:&nbsp;<input name="search_LIKE_name" class="form-control" placeholder="请输入职工名称" type="text">
			                        </label>
			                        <button id="btnSearch1" type="button" class="btn btn-primary btn-sm form-control">
			                            <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
			                        </button>
			                    </form>
			                </div>
			            </div>
			        </div>
			        <div id="tbWidget1" class="widget-box transparent ui-sortable-handle">
			            <div class="widget-body">
			                <div class="widget-main no-padding">
			                    <table id="table-data1" data-single-select="true"
			                        data-classes="table table-striped table-hover" 
			                           data-pagination="true"
			                           data-id-field="id"
			                           data-unique-id="id"
			                           data-sort-name="id"
			                           data-sort-order="asc">
			                    </table>
			                </div>
			            </div>
			        </div>
                </div>
                <div class="tab-pane fade in" id="user">
                    <div class="widget-box transparent" id="divSearch2">
                        <div class="widget-body">
                            <div class="widget-main">
                                <form name="frmSearch" id="frmSearch2" target="_self"  class="form-inline searchCondition">
                                    <!-- 数据权限 begion-->
                                    <c:if test="${organizationId != 1}"><input type="hidden" name="search_EQ_organization.id" value="${organizationId }"/></c:if>
                                    <!-- 数据权限 end-->
            <!--                        <input type="text" name="search_EQ_hospital.id"/> -->
                                    <label>
                                        用户名称:&nbsp;<input name="search_LIKE_name" class="form-control" placeholder="请输入用户名称" type="text">
                                    </label>
                                    <button id="btnSearch2" type="button" class="btn btn-primary btn-sm form-control">
                                        <i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
                                    </button>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div id="tbWidget2" class="widget-box transparent ui-sortable-handle">
                        <div class="widget-body">
                            <div class="widget-main no-padding">
                                <table id="table-data2" data-single-select="true"
                                    data-classes="table table-striped table-hover" 
                                       data-pagination="true"
                                       data-id-field="id"
                                       data-unique-id="id"
                                       data-sort-name="id"
                                       data-sort-order="asc">
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
	</div>
</div>
<script type="text/javascript">
var scripts = [];
$('.page-content-area').ace_ajax('loadScripts', scripts, function() {
	var ajaxListUrl1 = contextPath + '/manage/ordering/employee/list';//职工
	var ajaxListUrl2 = contextPath + '/manage/ordering/userInfo/list';//用户
	
    var columns1 = [ {
        field : 'state',
        checkbox : true,
        title : "选择"
    }, {
        field : 'user.mobile',
        sortable : false,
        title : "手机号"
    }, {
        field : 'name',
        sortable : false,
        title : "职工姓名"
    }, {
        field : 'department.name',
        sortable : false,
        title : "所属科室"
    }, {
        field : 'department.hospital.name',
        sortable : false,
        title : "所属医院"
    }
    ];
    var columns2 = [ {
        field : 'state',
        checkbox : true,
        title : "选择"
    }, {
        field : 'user.mobile',
        sortable : false,
        title : "手机号"
    }, {
        field : 'name',
        sortable : false,
        title : "用户姓名"
    }, {
        field : 'ward.name',
        sortable : false,
        title : "所属病房"
    }, {
        field : 'ward.hospital.name',
        sortable : false,
        title : "所属医院"
    }
    ];
    
	jQuery(function($) {
        initTable('table-data1', columns1, ajaxListUrl1, 'frmSearch1');
		// 搜索域控制
		$('#frmSearch1').find('#btnSearch1').on('click', function() {
			$('#table-data1').bootstrapTable('selectPage', 1);
		});

		$('#tbWidget1').on('reload.ace.widget', function(ev) {
			$('#table-data1').bootstrapTable('refresh', { silent : true });
		});
		
        initTable('table-data2', columns2, ajaxListUrl2, 'frmSearch2');
		// 搜索域控制
		$('#frmSearch2').find('#btnSearch2').on('click', function() {
			$('#table-data2').bootstrapTable('selectPage', 1);
		});

		$('#tbWidget2').on('reload.ace.widget', function(ev) {
			$('#table-data2').bootstrapTable('refresh', { silent : true });
		});
		
		$('#myTabs a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
		    $('#table-data1').bootstrapTable('selectPage', 1);
		    $('#table-data2').bootstrapTable('selectPage', 1);
        })
	});
});
</script>